package com.finger.userservice.controller.oss;

import com.finger.modelservice.result.Result;
import com.finger.userservice.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("site/user/oss")
@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("upload")
    public Result upload(MultipartFile file){

        String url = ossService.uploadPhoto(file);

        return Result.ok(url);
    }

}
